package com.sg.business.commons.labelprovider.usertask;

import java.util.Date;

import com.mobnut.commons.util.Utils;
import com.sg.business.model.UserTask;

public class DurationHtmlLabel extends AbstractUserTaskHtmlLabel {

	@Override
	public String getUserTaskText(UserTask userTask) {
		Object inProgress = userTask.getValue("InProgress"); //$NON-NLS-1$
		Date date = (inProgress instanceof Date) ? (Date) inProgress
				: new Date();

		long minus = date.getTime() - userTask.get_cdate().getTime();
		return Utils.getFriendlyDuration(minus, 2);
	}

}
